<?
$dbpass = $pg_password; //"w9JwRoA";
$dbuser = $pg_username; // "root";
$dbname = $pg_db; //"rp2";
$dbhost = $pg_host; //"209.25.134.4";

if(!$dbh4 = pg_connect("dbname=$dbname host=$dbhost user=$dbuser password=$dbpass")) {
	$errorMsg = translate('cannot_process_request');
	include_once('errorMsg.html');
	exit;
}
//exit('Error Processing your request');

include('../rp2/global_functions.php');
include('../rp2/mail_functions.php');
include('../rp2/functions.php');

$wallet_empty=translate('wallet_empty');
$wallet_bal_begin=translate('wallet_bal_begin');
$wallet_bal_end=translate('wallet_bal_end');

//------------------------------------------------------
$sql['type']='SELECT';
$sql['params']='*';
$sql['table']='wallet';
$sql['where']="reseller_id='$id' AND approved!='f'";
$sql['options']='ORDER BY currency ASC';
$sql['return']='struct';
//------------------------------------------------------

$params[sid] = $sid;
$params[action] = "walletAccountRefill";
$url = "$baseURL/$webDIR/?".encode_params($params);

$params[sid] = $sid;
$params[action] = "walletAccountRefill";
$url2 = "$baseURL/$webDIR/?".encode_params($params);

if ($result=sql_exec($sql,$dbh4,'assoc')) {
        echo "$wallet_availability";
        foreach ($result as $value) {
                echo "<font style=\"font-family: Arial, Helvetica, sans-serif; font-size: 8pt; color: #000000; text-decoration: none\">$wallet_bal_begin $value[amount] $value[currency] <a href=\"$url2\" class=\"links\">$wallet_bal_end</a></font>";
        }
} else {
        echo "<font style=\"font-family: Arial, Helvetica, sans-serif; font-size: 8pt; color: #000000; text-decoration: none\">$wallet_empty <a href=\"$url2\" class=\"links\">$wallet_bal_end</a></font>";
}
pg_close($dbh4);
?>
